import request from './request.js';
let service = request.service;
let formatterUrl = request.formatterUrl;
export default {
  /**采购物料清单列表*/
  cgMaterialList(data) {
    return service({
      url: `/adscm/operation/cg/cgMaterial/select`,
      method: 'post',
      data
    })
  },
  /***新增修改 采购物料清单 */
  insertUpdateMaterial(type, data) {
    return service({
      url: `/adscm/operation/cg/cgMaterial/${type}`,
      method: 'post',
      data
    })
  },
   /**模糊查询采购物料清单*/
  searchCgMaterial(data) {
    return service({
      url: `/adscm/operation/cg/cgMaterial/selectByKeyword`,
      method: 'get',
      params: data
    })
  },
  
  /***供应商基础信息列表 */
  cgSupplierList(data) {
    return service({
      url: `/adscm/operation/cg/cgSupplier/select`,
      method: 'post',
      data
    })
  },
  /***新增修改供应商 */
  insertUpdateSupplier(type,data){
    return service({
       url: `/adscm/operation/cg/cgSupplier/${type}`,
       method: 'post',
       data
     })
  },
  /**模糊查询供应商信息*/
  searchSupplierList(data) {
    return service({
      url: `/adscm/operation/cg/cgSupplier/selectByKeyWord`,
      method: 'get',
      params: data
    })
  },
  /**根据物料id查询管理供应商列表 */
  supplierListByMateralId(id) {
    return service({
      url: `/adscm/operation/cg/cgMaterialSupplier/selectByBid/${id}`,
      method: 'post'
    })
  },
   /**新增修改关联供应商信息*/
  insertUpdateSupplierByMateralId(type,data){
    return service({
      url: `/adscm/operation/cg/cgMaterialSupplier/${type}`,
      method: 'post',
      data
    })
  },
  /**删除关联供应商 */
  deleteLinkSupplier(id) {
    return service({
      url: `/adscm/operation/cg/cgMaterialSupplier/delete/${id}`,
      method: 'get'
    })
  },
  /**获取采购任务列表*/
  cgTaskList(data) {
    return service({
      url: `/adscm/operation/cg/cgTask/select`,
      method: 'post',
      data
    })
  },
  /**新增修改采购任务*/ 
  insertUpdateCgTask(type, data) {
    return service({
      url: `/adscm/operation/cg/cgTask/${type}`,
      method: 'post',
      data
    })
  },
  /**采购物品列表*/ 
  cgMaterialDetailList(tid) {
    return service({
      url: `/adscm/operation/cg/cgTaskDetail/selectByTid/${tid}`,
      method: 'post'
    })
  },
  insertUpdateCgMaterialDetail(type,data){
    /**采购物品 insert-新增 update-修改*/
    return service({
      url: `/adscm/operation/cg/cgTaskDetail/${type}`,
      method: 'post',
      data
    })
  },
  deleteCgMaterialDetail(id) {
    /**删除采购物品*/
    return service({
      url: `/adscm/operation/cg/cgTaskDetail/delete/${id}`,
      method: 'post'
    })
  },
  /**根据供应商id查询物料列表 */
  materialListBySupplierId(sid){
    return service({
      url: `/adscm/operation/cg/cgMaterialSupplier/selectCgMaterialBySid/${sid}`,
      method: 'post'
    })
  }  
}